#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

import sys

year = sys.argv[1]
start = int(sys.argv[2])
end = int(sys.argv[3])

outfile = open("D:/updatefiles.txt", "w")

for i in range(start, end + 1):
    outfile.write(
        "wget -c ftp://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/pubmed" + year + "n" + str(i).zfill(4) + ".xml.gz\n")
    outfile.write(
        "wget -c ftp://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/pubmed" + year + "n" + str(i).zfill(4) + ".xml.gz.md5\n")
    outfile.write(
        "wget -c ftp://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/pubmed" + year + "n" + str(i).zfill(4) + "_stats.html\n")
    outfile.flush()

outfile.close()
